/*
 * Copyright (c) 2021.版权所有高金磊
 */

package 领扣算法.A简单题.最大三角形面积;

import java.awt.*;

public class Main {

    public double largestTriangleArea(int[][] points) {
        double res=0;
        for (int i = 0; i < points.length-2; i++) {
            for (int j = i+1; j < points.length-1; j++) {
                for (int k = j+1; k < points.length; k++) {
                    res=Math.max(res, Math.abs(getarea(points[i],points[j],points[k]))/2);
                }
            }

        }

        return res;

    }


    double getarea(int[] point1,int[] point2,int[] point3){

        return (double) point1[0]*(point2[1]-point3[1])+(double)point2[0]*(point3[1]-point1[1])+(double)point3[0]*(point1[1]-point2[1]);
    }
    
    public static void main(String arg[]){//main--来自高金磊
    
        double res=new Main().largestTriangleArea(new int[][]{{0,0},{0,1},{1,0},{2,0},{0,2}});
        System.out.println(res);
    }
}
